/*
 * @(#)PatientQueryResponse.java
 * Date 2013-09-28
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.pix.model;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.hl7.v3.PRPAIN201309UV02;
import org.hl7.v3.PRPAMT201307UV02QueryByParameter;

import us.hornerscorners.lamppost.config.IServiceConfig;

import us.hornerscorners.lamppost.hl7v3common.constant.AckResponse;

import us.hornerscorners.lamppost.model.patient.Patient;


/**
 * Class description
 *
 *
 * @version        v1.0, 2013-09-28
 * @author         Jim Horner
 */
public class PatientQueryResponse {

    /** Field description */
    private final AckResponse ackResponse;

    /** Field description */
    private final List<Patient> patients;

    /** Field description */
    private final PRPAIN201309UV02 prpa309Request;

    /** Field description */
    private final PRPAMT201307UV02QueryByParameter queryParameters;

    /** Field description */
    private final IServiceConfig senderDevice;

    /**
     * Constructs ...
     *
     *
     * @param senderDevice
     * @param prpa309Request
     * @param queryParameters
     * @param patients
     */
    public PatientQueryResponse(IServiceConfig senderDevice,
                                PRPAIN201309UV02 prpa309Request,
                                PRPAMT201307UV02QueryByParameter queryParameters,
                                List<Patient> patients, AckResponse ackResponse) {

        super();

        this.senderDevice = senderDevice;
        this.prpa309Request = prpa309Request;
        this.queryParameters = queryParameters;
        this.patients = new ArrayList<>();
        this.patients.addAll(patients);
        this.ackResponse = ackResponse;
    }

    /**
     * Constructs ...
     *
     *
     * @param senderDevice
     * @param prpa309Request
     * @param queryParameters
     * @param patients
     */
    public PatientQueryResponse(IServiceConfig senderDevice,
                                PRPAIN201309UV02 prpa309Request,
                                PRPAMT201307UV02QueryByParameter queryParameters,
                                Patient[] patients, AckResponse ackResponse) {

        this(senderDevice, prpa309Request, queryParameters, Arrays.asList(patients),
             ackResponse);
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public AckResponse getAckResponse() {
        return ackResponse;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public Patient[] getPatients() {
        return this.patients.toArray(new Patient[this.patients.size()]);
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public PRPAIN201309UV02 getPrpa309Request() {
        return prpa309Request;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public PRPAMT201307UV02QueryByParameter getQueryParameters() {
        return queryParameters;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public IServiceConfig getSenderDevice() {
        return senderDevice;
    }
}
